//////////////////////////////////////////////////////////////////
//
//
//		AX, ringbuffer wrap
//
//		
//		
//
//
//
#ifndef _RINGBUFFER_WRAP_H
#define _RINGBUFFER_WRAP_H
#include "Critics.h"
//#define [IN/OUT]
//#define [IN]
//#define [OUT]
#define R_BUF_K(x) (1024*x)
#define R_BUF_M(x) (1024*1024*x)
class RBuffer
{
public:
	RBuffer(int nBufferSize = R_BUF_K(256));
	~RBuffer();

public:
	//return read size
	int Read(char* pBuf,int nSize);

	//return write size
	int Write(const char* pData,int nSize);

	//data len in ring buffer
	int GetAvailableReadSize();

	//writeable size in ringbuffer,just remain size
	int GetAvailableWriteSize();

	//ring buffer total size
	int GetBufferSize()const;

	//clear,reset write,read ptr
	void Reset();

private:
//	RBuffer&  operator=(const RBbuffer& l);
	void*         m_pRingBuffer;
	cmm_base::CriticalSection   m_cs;

};
#endif /* _RINGBUFFER_WRAP_H */
